import { ApiProperty } from '@nestjs/swagger';
import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { UserClient } from '../../userClient/assets/userClient.entity';
import {
  Constant_Enum_Enum_DistributionApply_Status,
  Constant_Enum_Name_DistributionApply_Status,
  IConstant_Enum_Type_DistributionApply_Status,
} from '@/common/constants/enum';

@Entity('distriteapply')
export class DistributionApply {
  @PrimaryGeneratedColumn()
  id: number;

  @ApiProperty({ description: '用户', type: () => UserClient })
  @ManyToOne(() => UserClient)
  userClient: UserClient;

  @CreateDateColumn({
    type: 'datetime',
    precision: 0,
    default: () => 'CURRENT_TIMESTAMP(0)',
    onUpdate: 'CURRENT_TIMESTAMP(0)',
  })
  @ApiProperty({ description: '申请时间' })
  daCreateTime: Date;

  @Column({ default: Constant_Enum_Enum_DistributionApply_Status.DistributionApply_Status_Processing })
  @ApiProperty({
    default: Constant_Enum_Enum_DistributionApply_Status.DistributionApply_Status_Processing,
    description: '申请状态' + Constant_Enum_Name_DistributionApply_Status,
    enum: Constant_Enum_Enum_DistributionApply_Status,
  })
  daStatus: IConstant_Enum_Type_DistributionApply_Status;

  @Column()
  @ApiProperty({ description: '联系方式' })
  daLinkWay: string;

  @Column({ nullable: true })
  @ApiProperty({ description: '备注' })
  daRemark: string;

  @Column()
  @ApiProperty({ description: '审核时间（2024-01-01 12:00:00形式）' })
  daProcessTime: string;
}
